package org.dromara.easyes.test.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.IdType;

import java.util.Date;

/**
 * @since 2019-10-14 15:22
 * @since logan-web 1.0
 */
@Data
@Accessors(chain = true)
@IndexName(value="logan_task-#{BY_MONTH}",shardsNum = 3, replicasNum = 2, keepGlobalPrefix = true)
public class LoganTaskDTO implements Comparable<LoganTaskDTO> {

    @IndexId(type = IdType.CUSTOMIZE)
    private Long id;

    private String amount;

    private String appId;

    private String unionId;

    private int platform;

    private String buildVersion;

    private String appVersion;

    private String deviceId;

    private long logDate;

    private String logFileName;

    private long addTime;

    private int status;

    private Date updateTime;

    @Override
    public int compareTo(LoganTaskDTO o) {
        if (null == o) {
            return 0;
        }
        if (logDate == o.logDate) {
            return id < o.getId() ? 1 : -1;
        }
        return logDate < o.getLogDate() ? 1 : -1;
    }

}
